<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Skilful: Исходный файл Skilful/Data/DataSourceModule.cs</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Создано системой Doxygen 1.7.1 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Поиск');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Титульная&nbsp;страница</span></a></li>
      <li><a href="namespaces.html"><span>Пакеты</span></a></li>
      <li><a href="annotated.html"><span>Классы</span></a></li>
      <li class="current"><a href="files.html"><span>Файлы</span></a></li>
      <li><a href="dirs.html"><span>Алфавитный&nbsp;указатель&nbsp;директорий</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Поиск" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Файлы</span></a></li>
    </ul>
  </div>
  <div class="navpath">
    <ul>
      <li><a class="el" href="dir_7adcdc1edff7620168fbc20357cad448.html">Skilful</a>      </li>
      <li><a class="el" href="dir_c777626736fbbff11bce263deda591b3.html">Data</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<h1>DataSourceModule.cs</h1>  </div>
</div>
<div class="contents">
<a href="_data_source_module_8cs.html">См. документацию.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 ﻿<span class="comment">//---------------------------------------------------------------------------------------------------------------</span>
<a name="l00002"></a>00002 <span class="comment">// Skilful. Tactica Adversa graphic and analysis tool.</span>
<a name="l00003"></a>00003 <span class="comment">// Copyright (C) 2010 &quot;...&quot;, Andrey Zyablitsev (skat)</span>
<a name="l00004"></a>00004 <span class="comment">//</span>
<a name="l00005"></a>00005 <span class="comment">// This program is free software; you can redistribute it and/or</span>
<a name="l00006"></a>00006 <span class="comment">// modify it under the terms of the GNU General Public License</span>
<a name="l00007"></a>00007 <span class="comment">// as published by the Free Software Foundation; either version 2</span>
<a name="l00008"></a>00008 <span class="comment">// of the License, or (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment">//</span>
<a name="l00010"></a>00010 <span class="comment">// This program is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00013"></a>00013 <span class="comment">// GNU General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment">//</span>
<a name="l00015"></a>00015 <span class="comment">// You should have received a copy of the GNU General Public License</span>
<a name="l00016"></a>00016 <span class="comment">// along with this program; if not, write to the Free Software</span>
<a name="l00017"></a>00017 <span class="comment">// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.</span>
<a name="l00018"></a>00018 <span class="comment">//</span>
<a name="l00019"></a>00019 <span class="comment">// mail: support@protoforma.com </span>
<a name="l00020"></a>00020 <span class="comment">//---------------------------------------------------------------------------------------------------------------</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="keyword">using</span> System;
<a name="l00024"></a>00024 <span class="keyword">using</span> System.IO;
<a name="l00025"></a>00025 <span class="keyword">using</span> System.Reflection;
<a name="l00026"></a>00026 <span class="keyword">using</span> System.Collections;
<a name="l00027"></a>00027 <span class="keyword">using</span> System.Collections.Generic;
<a name="l00028"></a>00028 <span class="keyword">using</span> System.Linq;
<a name="l00029"></a>00029 <span class="keyword">using</span> System.Text;
<a name="l00030"></a>00030 <span class="keyword">using</span> System.Windows.Forms;
<a name="l00031"></a>00031 <span class="keyword">using</span> Skilful.QuotesManager;
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="keyword">namespace </span>Skilful.Data
<a name="l00035"></a>00035 {
<a name="l00036"></a><a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">00036</a>     <span class="keyword">public</span> <span class="keyword">enum</span> <a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a> <span class="comment">//перечисление предопределенных функций длл</span>
<a name="l00037"></a>00037     {
<a name="l00038"></a>00038         SetTickHandler,
<a name="l00039"></a>00039         RemTickHandler,
<a name="l00040"></a>00040         <span class="keyword">import</span>,
<a name="l00041"></a>00041         init,
<a name="l00042"></a>00042         get_symbol_list,
<a name="l00043"></a>00043         get_symbol_count,
<a name="l00044"></a>00044         get_history_length,
<a name="l00045"></a>00045         get_tick,
<a name="l00046"></a>00046         get_bar,
<a name="l00047"></a>00047         get_pip_value,
<a name="l00048"></a>00048         storagePath,
<a name="l00049"></a>00049         count
<a name="l00050"></a>00050     }
<a name="l00051"></a><a class="code" href="namespace_skilful_1_1_data.html#aa1ddf568bee8488bceab49c81df9a111">00051</a>     <span class="keyword">public</span> <span class="keyword">enum</span> <a class="code" href="namespace_skilful_1_1_data.html#aa1ddf568bee8488bceab49c81df9a111">evt</a>
<a name="l00052"></a>00052     {
<a name="l00053"></a>00053         new_tick,
<a name="l00054"></a>00054         new_bar,
<a name="l00055"></a>00055         count
<a name="l00056"></a>00056     }
<a name="l00057"></a><a class="code" href="namespace_skilful_1_1_data.html#a8184817815af475bdb725292d9eb7c51">00057</a>     <span class="keyword">public</span> <span class="keyword">enum</span> <a class="code" href="namespace_skilful_1_1_data.html#a8184817815af475bdb725292d9eb7c51">LoginType</a> { SelectFile, SelectDir, SetIPLoginPassword, UserDefinedForm }
<a name="l00058"></a>00058     <span class="comment">//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//</span>
<a name="l00059"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html">00059</a>     <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html">DataSourseModule</a>
<a name="l00060"></a>00060     {
<a name="l00061"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a7c5e1ee41e5362dd93d74473ff3c55bf">00061</a>         <span class="keyword">public</span> Object inst;
<a name="l00062"></a>00062         Dictionary&lt;string, int&gt; symslen;
<a name="l00063"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a03969fa5f1c1882d5864ec1d2b19a095">00063</a>         <span class="keyword">public</span> <span class="keywordtype">string</span> name, prompt;
<a name="l00064"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a5c5b125fd9f2448496a682f23027721a">00064</a>         <span class="keyword">public</span> <span class="keywordtype">bool</span> enabled;
<a name="l00065"></a>00065 
<a name="l00066"></a>00066         <span class="comment">//преобразование С_строки заканчивающейся 0 из массива char в строку С#</span>
<a name="l00067"></a>00067         <span class="keyword">static</span> <span class="keywordtype">string</span> c2a(<span class="keywordtype">char</span>[] s)
<a name="l00068"></a>00068         {
<a name="l00069"></a>00069             <span class="keywordtype">int</span> cnt = 0;
<a name="l00070"></a>00070             <span class="keywordflow">while</span> (s[cnt++] != <span class="charliteral">&#39;\0&#39;</span> &amp;&amp; s.Length &gt; cnt) ;
<a name="l00071"></a>00071             <span class="keywordflow">return</span> <span class="keyword">new</span> string(s, 0, cnt - 1);
<a name="l00072"></a>00072         }
<a name="l00073"></a>00073         MethodInfo[] method = <span class="keyword">new</span> MethodInfo[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.count];
<a name="l00074"></a>00074         EventInfo[] events = <span class="keyword">new</span> EventInfo[(<span class="keywordtype">int</span>)<a class="code" href="namespace_skilful_1_1_data.html#aa1ddf568bee8488bceab49c81df9a111">evt</a>.count];
<a name="l00075"></a>00075 
<a name="l00076"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a60bd8f0a2beaf5541dc4ce43c7e09596">00076</a>         public EventInfo Event(<a class="code" href="namespace_skilful_1_1_data.html#aa1ddf568bee8488bceab49c81df9a111">evt</a> i)
<a name="l00077"></a>00077         {
<a name="l00078"></a>00078             <span class="keywordflow">return</span> events[(int)i];
<a name="l00079"></a>00079         }
<a name="l00080"></a>00080 
<a name="l00081"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#abc7e5a26c03edd35c6324b2045520492">00081</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> SetMethod(<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a> i, MethodInfo ptr)
<a name="l00082"></a>00082         {
<a name="l00083"></a>00083             method[(int)i] = ptr;
<a name="l00084"></a>00084         }
<a name="l00085"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a3caca8e522105bb23391e85adb343222">00085</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> SetEvent(<a class="code" href="namespace_skilful_1_1_data.html#aa1ddf568bee8488bceab49c81df9a111">evt</a> i, EventInfo ei)
<a name="l00086"></a>00086         {
<a name="l00087"></a>00087             events[(int)i] = ei;
<a name="l00088"></a>00088         }
<a name="l00089"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a8d0d78001021fa4f1c9fa708b66c6a4c">00089</a>         <span class="keyword">public</span> <a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a> methods_count()
<a name="l00090"></a>00090         {
<a name="l00091"></a>00091             <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; (int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.count; i++)
<a name="l00092"></a>00092             {
<a name="l00093"></a>00093                 <span class="keywordflow">if</span> (method[i] == null) <span class="keywordflow">return</span> (<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>)i;
<a name="l00094"></a>00094             }
<a name="l00095"></a>00095             <span class="keywordflow">return</span> <a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.count;
<a name="l00096"></a>00096         }
<a name="l00097"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a5dc50f5b83f0f78527644403b645dd2c">00097</a>         <span class="keyword">public</span> <span class="keywordtype">bool</span> validate_lib()
<a name="l00098"></a>00098         {
<a name="l00099"></a>00099             <span class="comment">//как минимум 4 метода должены быть реализованы в длл</span>
<a name="l00100"></a>00100             <span class="keywordflow">return</span> method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.init] != null
<a name="l00101"></a>00101                 &amp;&amp; method[(<span class="keywordtype">int</span>)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.import] != null
<a name="l00102"></a>00102                 &amp;&amp; method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_symbol_list] != null
<a name="l00103"></a>00103                 &amp;&amp; method[(<span class="keywordtype">int</span>)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_symbol_list].GetParameters().Length == 3
<a name="l00104"></a>00104                 &amp;&amp; method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_symbol_count] != null;
<a name="l00105"></a>00105         }
<a name="l00106"></a>00106 
<a name="l00112"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#ac11025d62edc67cb69873505d9d38338">00112</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> SetTickHandler(<span class="keywordtype">string</span> sym)
<a name="l00113"></a>00113         {
<a name="l00114"></a>00114             <span class="keywordflow">if</span> (method[(<span class="keywordtype">int</span>)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.SetTickHandler] != null)
<a name="l00115"></a>00115             {
<a name="l00116"></a>00116                 <span class="keywordtype">object</span>[] args = { sym };
<a name="l00117"></a>00117                 method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.SetTickHandler].Invoke(inst, args);
<a name="l00118"></a>00118             }
<a name="l00119"></a>00119         }
<a name="l00120"></a>00120 
<a name="l00125"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a062299ca109a323d165d315434813182">00125</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> RemTickHandler(<span class="keywordtype">string</span> sym)
<a name="l00126"></a>00126         {
<a name="l00127"></a>00127             <span class="keywordflow">if</span> (method[(<span class="keywordtype">int</span>)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.RemTickHandler] != null)
<a name="l00128"></a>00128             {
<a name="l00129"></a>00129                 <span class="keywordtype">object</span>[] args = { sym };
<a name="l00130"></a>00130                 method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.RemTickHandler].Invoke(inst, args);
<a name="l00131"></a>00131             }
<a name="l00132"></a>00132         }
<a name="l00133"></a>00133 
<a name="l00134"></a>00134         <span class="comment">//импорт истории для данного символа, часовой фрейм</span>
<a name="l00135"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#ab2c0a12f6ac03a861c5dab19cb3b7737">00135</a>         <span class="keyword">public</span> <span class="keywordtype">double</span>[] <span class="keyword">import</span>(<span class="keywordtype">string</span> sym, <span class="keywordtype">int</span> shift, <span class="keywordtype">int</span> len)
<a name="l00136"></a>00136         {
<a name="l00137"></a>00137             <span class="keywordtype">double</span>[] quotes = <span class="keyword">new</span> <span class="keywordtype">double</span>[symslen[sym] * 5];
<a name="l00138"></a>00138             <span class="keywordtype">int</span>[] _len = { len };
<a name="l00139"></a>00139             <span class="keywordtype">object</span>[] args = { sym, <a class="code" href="namespace_skilful_1_1_quotes_manager.html#a5c84c6ba01636871f8f98492b465c315">TF</a>.m60, shift, _len, quotes };
<a name="l00140"></a>00140             method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.import].Invoke(inst, args);
<a name="l00141"></a>00141             <span class="keywordflow">return</span> quotes;
<a name="l00142"></a>00142         }
<a name="l00143"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a6fc3ee81dfecab31981b485e4a8dc062">00143</a>         <span class="keyword">public</span> <span class="keywordtype">double</span>[] <span class="keyword">import</span>(<span class="keywordtype">string</span> sym)
<a name="l00144"></a>00144         {
<a name="l00145"></a>00145             <span class="keywordflow">return</span> <span class="keyword">import</span>(sym, 0, 0);
<a name="l00146"></a>00146         }
<a name="l00147"></a>00147 
<a name="l00155"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a00e67fbca8116606b7c9514dc3dfe16e">00155</a>         <span class="keyword">public</span> <span class="keywordtype">int</span> get_history_length(<span class="keywordtype">string</span> sym, <a class="code" href="namespace_skilful_1_1_quotes_manager.html#a5c84c6ba01636871f8f98492b465c315">TF</a> tf)
<a name="l00156"></a>00156         {
<a name="l00157"></a>00157             <span class="keywordflow">if</span> (method[(<span class="keywordtype">int</span>)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_history_length] == null) <span class="keywordflow">return</span> 0;
<a name="l00158"></a>00158             <span class="keywordtype">int</span>[] len = <span class="keyword">new</span> <span class="keywordtype">int</span>[1];
<a name="l00159"></a>00159             <span class="keywordtype">object</span>[] args = { sym, tf, len };
<a name="l00160"></a>00160             method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_history_length].Invoke(inst, args);
<a name="l00161"></a>00161             <span class="keywordflow">return</span> len[0];
<a name="l00162"></a>00162         }
<a name="l00163"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#afb49fdc685a312642d2e5da18410c032">00163</a>         <span class="keyword">public</span> <span class="keywordtype">double</span>[] <span class="keyword">import</span>(<span class="keywordtype">string</span> sym, <a class="code" href="namespace_skilful_1_1_quotes_manager.html#a5c84c6ba01636871f8f98492b465c315">TF</a> tf)
<a name="l00164"></a>00164         {
<a name="l00165"></a>00165             <span class="keywordflow">return</span> <span class="keyword">import</span>(sym, tf, 0, 0);
<a name="l00166"></a>00166         }
<a name="l00167"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#adc2ca454ddfb037a19ac195c0fced7f8">00167</a>         <span class="keyword">public</span> <span class="keywordtype">double</span>[] <span class="keyword">import</span>(<span class="keywordtype">string</span> sym, <a class="code" href="namespace_skilful_1_1_quotes_manager.html#a5c84c6ba01636871f8f98492b465c315">TF</a> tf, <span class="keywordtype">int</span> shift, <span class="keywordtype">int</span> len)
<a name="l00168"></a>00168         {
<a name="l00169"></a>00169             <span class="keywordtype">int</span> cnt = get_history_length(sym, tf);
<a name="l00170"></a>00170             <span class="keywordflow">if</span> (len == 0 || len &gt; cnt) len = cnt;
<a name="l00171"></a>00171             <span class="keywordflow">if</span> (len &gt; 0)
<a name="l00172"></a>00172             {
<a name="l00173"></a>00173                 <span class="keywordtype">double</span>[] quotes = <span class="keyword">new</span> <span class="keywordtype">double</span>[len * 5];
<a name="l00174"></a>00174                 <span class="keywordtype">int</span>[] len_ = {len};
<a name="l00175"></a>00175                 <span class="keywordtype">object</span>[] args = { sym, tf, shift, len_, quotes };
<a name="l00176"></a>00176                 
<a name="l00177"></a>00177                 method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.import].Invoke(inst, args);
<a name="l00178"></a>00178 
<a name="l00179"></a>00179                 <span class="comment">//resize by real data count</span>
<a name="l00180"></a>00180                 <span class="keywordflow">if</span>(len_[0] &lt; len) Array.Resize(ref quotes, len_[0]*5);
<a name="l00181"></a>00181                 
<a name="l00182"></a>00182                 <span class="comment">//trancate quotes array</span>
<a name="l00183"></a>00183                 <span class="keywordflow">if</span> (quotes[(len_[0] - 1) * 5] == 0)
<a name="l00184"></a>00184                 {
<a name="l00185"></a>00185                     <span class="keywordtype">int</span> i = (len_[0] - 1) * 5;
<a name="l00186"></a>00186                     <span class="keywordflow">while</span> (quotes[i] == 0 &amp;&amp; i &gt;= 5) i -= 5;
<a name="l00187"></a>00187                     Array.Resize(ref quotes, i + 5);
<a name="l00188"></a>00188                 }
<a name="l00189"></a>00189                 <span class="keywordflow">return</span> quotes;
<a name="l00190"></a>00190             }
<a name="l00191"></a>00191             <span class="keywordflow">else</span>
<a name="l00192"></a>00192                 <span class="keywordflow">return</span> null;
<a name="l00193"></a>00193         }
<a name="l00203"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a28092a8f1bc159a4cd4dd403f222c02f">00203</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> init(out <span class="keywordtype">string</span> name, out <span class="keywordtype">string</span> prompt, out <span class="keywordtype">string</span> description, out <a class="code" href="namespace_skilful_1_1_data.html#a8184817815af475bdb725292d9eb7c51">LoginType</a> ltype)
<a name="l00204"></a>00204         {
<a name="l00205"></a>00205             <span class="keywordtype">char</span>[] cname = <span class="keyword">new</span> <span class="keywordtype">char</span>[256], cuserstring = <span class="keyword">new</span> <span class="keywordtype">char</span>[256], cdescription = <span class="keyword">new</span> <span class="keywordtype">char</span>[256];
<a name="l00206"></a>00206             <span class="keywordtype">int</span>[] cltype = <span class="keyword">new</span> <span class="keywordtype">int</span>[1];
<a name="l00207"></a>00207             <span class="keywordtype">object</span>[] args = { cname, cuserstring, cdescription, cltype };
<a name="l00208"></a>00208             method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.init].Invoke(inst, args);
<a name="l00209"></a>00209             this.name = name = c2a(cname);
<a name="l00210"></a>00210             this.prompt = prompt = c2a(cuserstring);
<a name="l00211"></a>00211             description = c2a(cdescription);
<a name="l00212"></a>00212             ltype = (LoginType)cltype[0];
<a name="l00213"></a>00213         }
<a name="l00214"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#aaf51e5f8501e95478769ac027db3a087">00214</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> init()
<a name="l00215"></a>00215         {
<a name="l00216"></a>00216             <span class="keywordtype">char</span>[] cname = <span class="keyword">new</span> <span class="keywordtype">char</span>[256], cuserstring = <span class="keyword">new</span> <span class="keywordtype">char</span>[256], cdescription = <span class="keyword">new</span> <span class="keywordtype">char</span>[256];
<a name="l00217"></a>00217             <span class="keywordtype">int</span>[] cltype = <span class="keyword">new</span> <span class="keywordtype">int</span>[1];
<a name="l00218"></a>00218             <span class="keywordtype">object</span>[] args = { cname, cuserstring, cdescription, cltype };
<a name="l00219"></a>00219             method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.init].Invoke(inst, args);
<a name="l00220"></a>00220             name = c2a(cname);
<a name="l00221"></a>00221             prompt = c2a(cuserstring);
<a name="l00222"></a>00222         }
<a name="l00223"></a>00223         <span class="comment">//чтение и инициализация файла</span>
<a name="l00231"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a379dbef482514a88ee2b63e76f0a8e8c">00231</a> <span class="comment"></span>        <span class="keyword">public</span> <span class="keywordtype">string</span>[] get_symbol_list(<span class="keywordtype">string</span> filename, out <span class="keywordtype">int</span>[] period, out <span class="keywordtype">int</span>[] len)
<a name="l00232"></a>00232         {
<a name="l00233"></a>00233             <span class="comment">//get_symbol_count</span>
<a name="l00234"></a>00234             <span class="keywordtype">int</span> cnt = get_symbol_count(filename);
<a name="l00235"></a>00235 
<a name="l00236"></a>00236             <span class="keywordtype">string</span>[] symbols = <span class="keyword">new</span> <span class="keywordtype">string</span>[cnt];
<a name="l00237"></a>00237             len = <span class="keyword">new</span> <span class="keywordtype">int</span>[cnt];
<a name="l00238"></a>00238             period = <span class="keyword">new</span> <span class="keywordtype">int</span>[cnt];
<a name="l00239"></a>00239 
<a name="l00240"></a>00240             <span class="keywordtype">object</span>[] args = { symbols, period, len };
<a name="l00241"></a>00241             method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_symbol_list].Invoke(inst, args);
<a name="l00242"></a>00242 
<a name="l00243"></a>00243             symslen = <span class="keyword">new</span> Dictionary&lt;string, int&gt;(cnt);
<a name="l00244"></a>00244             <span class="keywordtype">int</span> f = 0;
<a name="l00245"></a>00245             <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; cnt; i++)
<a name="l00246"></a>00246             {
<a name="l00247"></a>00247                 <span class="keywordflow">if</span> (symbols[i] != null)
<a name="l00248"></a>00248                     symslen[symbols[i]] = len[i];
<a name="l00249"></a>00249                 <span class="keywordflow">else</span>
<a name="l00250"></a>00250                     f++;
<a name="l00251"></a>00251             }
<a name="l00252"></a>00252             <span class="keywordflow">if</span> (f &gt; 0)<span class="comment">//some files not accessable, need compress list</span>
<a name="l00253"></a>00253             {
<a name="l00254"></a>00254                 <span class="keywordtype">int</span>[] _len = len, _period = period;
<a name="l00255"></a>00255                 <span class="keywordtype">string</span>[] _symbols = symbols;
<a name="l00256"></a>00256                 cnt -= f;
<a name="l00257"></a>00257                 symbols = <span class="keyword">new</span> <span class="keywordtype">string</span>[cnt];
<a name="l00258"></a>00258                 len = <span class="keyword">new</span> <span class="keywordtype">int</span>[cnt];
<a name="l00259"></a>00259                 period = <span class="keyword">new</span> <span class="keywordtype">int</span>[cnt];
<a name="l00260"></a>00260                 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0, j = 0; i &lt; cnt; i++)
<a name="l00261"></a>00261                 {
<a name="l00262"></a>00262                     <span class="keywordflow">if</span> (_symbols[i] != null)
<a name="l00263"></a>00263                     {
<a name="l00264"></a>00264                         symbols[j] = _symbols[i];
<a name="l00265"></a>00265                         len[j] = _len[i];
<a name="l00266"></a>00266                         period[j++] = _period[i];
<a name="l00267"></a>00267                     }
<a name="l00268"></a>00268                 }
<a name="l00269"></a>00269             }
<a name="l00270"></a>00270             <span class="keywordflow">return</span> symbols;
<a name="l00271"></a>00271         }
<a name="l00276"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a3ef87d59e61a940bfbf2161b5c9adc2b">00276</a>         <span class="keyword">public</span> <span class="keywordtype">string</span>[] get_symbol_list(<span class="keywordtype">string</span> filepath)
<a name="l00277"></a>00277         {
<a name="l00278"></a>00278             <span class="keywordtype">int</span>[] period;
<a name="l00279"></a>00279             <span class="keywordtype">int</span>[] len;
<a name="l00280"></a>00280             <span class="keywordflow">return</span> get_symbol_list(filepath, out period, out len);
<a name="l00281"></a>00281         }
<a name="l00287"></a>00287         <span class="keyword">private</span> <span class="keywordtype">int</span> get_symbol_count(<span class="keywordtype">string</span> filename)
<a name="l00288"></a>00288         {
<a name="l00289"></a>00289             <span class="keywordtype">int</span>[] count = <span class="keyword">new</span> <span class="keywordtype">int</span>[1];
<a name="l00290"></a>00290             <span class="keywordtype">object</span>[] args = { filename, count };
<a name="l00291"></a>00291             method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_symbol_count].Invoke(inst, args);
<a name="l00292"></a>00292             <span class="keywordflow">return</span> count[0];
<a name="l00293"></a>00293         }
<a name="l00294"></a>00294         <span class="comment">//следующие 2 метода могут вызываться менеджером данных с определенным интервалом</span>
<a name="l00295"></a>00295         <span class="comment">//double[] tick == tick[0]=bid, tick[1]=ask, tick[2]=time(day.miliseconds)</span>
<a name="l00296"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a1c0c958802e5487a281b26c5763284fc">00296</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> get_tick(<span class="keywordtype">string</span> sym, <span class="keywordtype">double</span>[] tick)
<a name="l00297"></a>00297         {
<a name="l00298"></a>00298             <span class="keywordflow">if</span> (method[(<span class="keywordtype">int</span>)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_tick] != null)
<a name="l00299"></a>00299             {
<a name="l00300"></a>00300                 <span class="keywordtype">object</span>[] args = { sym, tick };
<a name="l00301"></a>00301                 method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_tick].Invoke(inst, args);
<a name="l00302"></a>00302             }
<a name="l00303"></a>00303         }
<a name="l00306"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#aa50cbe419803adf61a4ee092455c7d73">00306</a>         <span class="keyword">public</span> <span class="keywordtype">double</span>[] get_bar(<span class="keywordtype">string</span> sym, <a class="code" href="namespace_skilful_1_1_quotes_manager.html#a5c84c6ba01636871f8f98492b465c315">TF</a> frame, DateTime lastTime, <span class="keywordtype">int</span> lastPosition)
<a name="l00307"></a>00307         {
<a name="l00308"></a>00308             <span class="keywordtype">double</span>[] bar = null;
<a name="l00309"></a>00309             <span class="keywordflow">if</span> (method[(<span class="keywordtype">int</span>)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_bar] != null)
<a name="l00310"></a>00310             {
<a name="l00311"></a>00311                 bar = <span class="keyword">new</span> <span class="keywordtype">double</span>[5];
<a name="l00312"></a>00312                 <span class="keywordtype">object</span>[] args = { sym, frame, lastTime, lastPosition };
<a name="l00313"></a>00313                 method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_bar].Invoke(inst, args);
<a name="l00314"></a>00314             }
<a name="l00315"></a>00315             <span class="keywordflow">return</span> bar;
<a name="l00316"></a>00316         }
<a name="l00317"></a>00317 
<a name="l00318"></a>00318         <span class="comment">//шаг изменения цены для данного инструмента</span>
<a name="l00319"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#ab692fb45aa0702416deca4a168678248">00319</a>         <span class="keyword">public</span> <span class="keywordtype">double</span> get_pip_value(<span class="keywordtype">string</span> sym)
<a name="l00320"></a>00320         {
<a name="l00321"></a>00321             <span class="keywordtype">double</span>[] pip = <span class="keyword">new</span> <span class="keywordtype">double</span>[1];
<a name="l00322"></a>00322             <span class="keywordflow">if</span> (method[(<span class="keywordtype">int</span>)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_pip_value] != null)
<a name="l00323"></a>00323             {
<a name="l00324"></a>00324                 <span class="keywordtype">object</span>[] args = { sym, pip };
<a name="l00325"></a>00325                 method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.get_pip_value].Invoke(inst, args);
<a name="l00326"></a>00326             }
<a name="l00327"></a>00327             <span class="keywordflow">return</span> pip[0];
<a name="l00328"></a>00328         }
<a name="l00329"></a>00329 
<a name="l00330"></a>00330         <span class="comment">//локальный путь для базы котировок</span>
<a name="l00331"></a>00331         <span class="keyword">private</span> <span class="keywordtype">string</span> storagePath(<span class="keywordtype">string</span> path)
<a name="l00332"></a>00332         {
<a name="l00333"></a>00333             <span class="keywordflow">if</span> (method[(<span class="keywordtype">int</span>)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.storagePath] != null)
<a name="l00334"></a>00334             {
<a name="l00335"></a>00335                 <span class="keywordtype">char</span>[] cpath = path != null &amp;&amp; path.Length &gt; 0 ? path.ToCharArray() : <span class="keyword">new</span> <span class="keywordtype">char</span>[256];
<a name="l00336"></a>00336                 <span class="keywordtype">object</span>[] args = { cpath };
<a name="l00337"></a>00337                 method[(int)<a class="code" href="namespace_skilful_1_1_data.html#a30a6dd1341a4e7b055a064fb4fe6415d">dm</a>.storagePath].Invoke(inst, args);
<a name="l00338"></a>00338                 <span class="keywordflow">return</span> c2a(cpath);
<a name="l00339"></a>00339             }
<a name="l00340"></a>00340             <span class="keywordflow">return</span> <span class="stringliteral">&quot;&quot;</span>;
<a name="l00341"></a>00341         }
<a name="l00342"></a>00342 
<a name="l00343"></a>00343         <span class="keyword">public</span> <span class="keywordtype">string</span> StoragePath
<a name="l00344"></a><a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#ae32e7f18d3dbe3be3145b298ed29d655">00344</a>         {
<a name="l00345"></a>00345             <span class="keyword">get</span>
<a name="l00346"></a>00346             {
<a name="l00347"></a>00347                 <span class="keywordflow">return</span> storagePath(null);
<a name="l00348"></a>00348             }
<a name="l00349"></a>00349             <span class="keyword">set</span>
<a name="l00350"></a>00350             {
<a name="l00351"></a>00351                 storagePath(value);
<a name="l00352"></a>00352             }
<a name="l00353"></a>00353         }
<a name="l00354"></a>00354     }
<a name="l00355"></a>00355     <span class="comment">//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//</span>
<a name="l00356"></a>00356 }
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>Указатель</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Классы</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Пространства имен</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Файлы</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Функции</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Переменные</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Перечисления</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&nbsp;</span>Свойства</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&nbsp;</span>События</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Создано системой&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>
